#!/usr/bin/env python
# -*- coding: utf-8 -*-

# #portugues@ScoutLink 2006 JOTI Bot (slbot)
# Copyright (c) 2006, ScoutLink #portugues team
# This source is released under the New BSD License. See the LICENSE file for further
# information.

# $Author$
# $Date$ 

__version__ = "$Revision$"
# $Source$

class IRCChan:
    """Channel abstraction class. Keeps track of user list, ops list, topic,
internal banlist, etc. All those attributes are kept as properties, and are
accessed thru access methods.

    """

    __channel = ""
    __users = []
    __ops   = []

    def __init__(self, channel_name):
        self.__channel = channel_name

    def addUser(self, usernick):
        self.__users.append(usernick.lower())

    def remUser(self, usernick):
        self.__users.remove(usernick.lower())
        
    def updateLastSent(self, user):
        pass
        
    def isOnChan(self, user):
        try:
            a = self.__users.index(user.lower())
        except ValueError:
            return False
        return True

    # access methods -- hence, no documentation is given
    def __getChannelName(self):
        return self.__channel

    def __getUsers(self):
        return self.__users

    def __getOps(self):
        return self.__ops 

    # registers all properties 
    channel = property(__getChannelName)
    users = property(__getUsers)
    ops = property(__getOps)
